package com.jiang.demo.common;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * ---------------------------------------------------------------------------------------------------------------
 * - 2024-06-01 15:24 - jiangshaoneng -
 * ---------------------------------------------------------------------------------------------------------------
 * -      ██╗██╗ █████╗ ███╗   ██╗ ██████╗ ███████╗██╗  ██╗ █████╗  ██████╗ ███╗   ██╗███████╗███╗   ██╗ ██████╗
 * -      ██║██║██╔══██╗████╗  ██║██╔════╝ ██╔════╝██║  ██║██╔══██╗██╔═══██╗████╗  ██║██╔════╝████╗  ██║██╔════╝
 * -      ██║██║███████║██╔██╗ ██║██║  ███╗███████╗███████║███████║██║   ██║██╔██╗ ██║█████╗  ██╔██╗ ██║██║  ███╗
 * - ██   ██║██║██╔══██║██║╚██╗██║██║   ██║╚════██║██╔══██║██╔══██║██║   ██║██║╚██╗██║██╔══╝  ██║╚██╗██║██║   ██║
 * - ╚█████╔╝██║██║  ██║██║ ╚████║╚██████╔╝███████║██║  ██║██║  ██║╚██████╔╝██║ ╚████║███████╗██║ ╚████║╚██████╔╝
 * -  ╚════╝ ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝╚══════╝╚═╝  ╚═══╝ ╚═════╝
 * ---------------------------------------------------------------------------------------------------------------
 * 自定义的异常码
 * ---------------------------------------------------------------------------------------------------------------
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class MSGException extends RuntimeException {

    // 错误码
    private int code;

    public MSGException(int code, String message) {
        super(message);
        this.code = code;
    }


    // 系统公共错误
    public static MSGException PARAM_ERROR = new MSGException(-1000, "参数错误");
    public static MSGException LOGIN_ERROR = new MSGException(-1001, "未登录");
    public static MSGException AUTH_ERROR  = new MSGException(-1002, "无权限");
    public static MSGException TOKEN_ERROR = new MSGException(-1003, "token错误");
    public static MSGException SIGN_ERROR  = new MSGException(-1004, "签名错误");
    // ......
    public static MSGException DATA_ERROR  = new MSGException(-1100, "数据不存在");
}